const koaRouter = require('koa-router');
const dao = require('../common/db');

const router = new koaRouter({
    prefix: '/dbTestConn'
});

// 插入一条数据
router.get('/insert', async ctx => {
    let res = await dao.insert({ id: 101, name: 'Blue - 川咯咯', age: 18, gender: '女' }, 'users');
    ctx.body = res;
});

// 根据指定条件查询某一条数据
router.get('/query', async ctx => {
    let res = await dao.query({ id: 101 }, 'users');
    ctx.body = res;
});

module.exports = router;